﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace Bluebunnie.Extensions
{
    public class PulseControl: UserControl
    {
        public RoutedEventHandler Save;

        public void SaveAndClose()
        {
            if (Save != null)
                Save(this, new RoutedEventArgs());
            Close();
        }

        public virtual void Close()
        {
            Shell.Current.Close(Title);
        }

        public string Title { get; set; }

        public virtual void Refresh()
        {

        }

        protected override void OnKeyUp(System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.F5)
                Refresh();
            base.OnKeyUp(e);
        }
    }
}
